.atk-comment-wrap {
  overflow: hidden;
  position: relative;
  border-bottom: 1px solid transparent;

  &.atk-flash-once {
    animation: atkFlashOnce 1s ease-in-out 0s;

    @keyframes atkFlashOnce {
      from {
        background: rgba(0, 131, 255, 0.2);
      }
      to {
        background: transparent;
      }
    }
  }

  &.atk-unread:before {
    content: ' ';
    position: absolute;
    left: 0;
    top: 10%;
    width: 3px;
    height: 80%;
    background: var(--at-color-main);
  }

  &.atk-openable {
    cursor: pointer;

    &:hover {
      background: var(--at-color-bg-grey);
    }

    .atk-height-limit:after {
      background: transparent !important;
    }
  }

  &:last-child {
    border-bottom: none;
  }
}

.atk-comment {
  display: block;
  padding: 10px;

  & > .atk-avatar {
    display: block;
    padding: 2px 0;
    float: left;

    img {
      width: 50px;
      height: 50px;
      border-radius: calc($block-radius / 2);
    }
  }

  & > .atk-main {
    display: block;
    margin-left: 63px;

    & > .atk-header {
      line-height: 1.5;
      font-size: 13px;
      margin-bottom: 0.5em;
      overflow: hidden;
      position: relative;
      display: flex;
      flex-wrap: wrap;
      align-items: center;

      .atk-item {
        display: flex;
        align-items: center;
        margin-top: 2px;
        margin-bottom: 2px;
        color: var(--at-color-meta);

        &:not(:last-child) {
          margin-right: 6px;
        }

        &.atk-nick,
        &.atk-nick a {
          font-size: 14px;
          color: var(--at-color-main);
          text-decoration: none;
        }

        &.atk-reply-at {
          margin-left: 2px;

          & > .atk-arrow:before {
            content: '';
            vertical-align: middle;
            transform: rotate(90deg);
            border-bottom: 4px solid var(--at-color-grey);
            border-left: 3px solid transparent;
            border-right: 3px solid transparent;
            display: inline-block;
            margin-top: -1px;
          }

          & > .atk-nick {
            color: var(--at-color-main);
            cursor: pointer;
            margin-left: 6px;
          }
        }
      }

      .badge {
        display: inline-block;
        color: var(--at-color-meta);
        background: var(--at-color-bg-grey);
        padding: 0px 6px;
        line-height: 17px;
        border-radius: calc($block-radius / 2);

        &:not(:last-child) {
          margin-right: 6px;
        }
      }

      .atk-badge-wrap > *:last-child {
        margin-right: 6px;
      }

      .atk-badge {
        @extend .badge;
        color: #fff;
      }

      .atk-region-badge {
        @extend .badge;
      }

      .atk-pinned-badge {
        @extend .badge;
        color: #fff;
        background: #f44336;
      }

      .atk-verified-icon {
        height: 1.4em;
        width: 1.4em;
        background-repeat: no-repeat;
        background-position: center;
        background-size: contain;
        display: block;
        background-image: url('data:image/svg+xml,<svg viewBox="0 0 22 22" xmlns="http://www.w3.org/2000/svg" fill="%231d9bf0"><g><path d="M20.396 11c-.018-.646-.215-1.275-.57-1.816-.354-.54-.852-.972-1.438-1.246.223-.607.27-1.264.14-1.897-.131-.634-.437-1.218-.882-1.687-.47-.445-1.053-.75-1.687-.882-.633-.13-1.29-.083-1.897.14-.273-.587-.704-1.086-1.245-1.44S11.647 1.62 11 1.604c-.646.017-1.273.213-1.813.568s-.969.854-1.24 1.44c-.608-.223-1.267-.272-1.902-.14-.635.13-1.22.436-1.69.882-.445.47-.749 1.055-.878 1.688-.13.633-.08 1.29.144 1.896-.587.274-1.087.705-1.443 1.245-.356.54-.555 1.17-.574 1.817.02.647.218 1.276.574 1.817.356.54.856.972 1.443 1.245-.224.606-.274 1.263-.144 1.896.13.634.433 1.218.877 1.688.47.443 1.054.747 1.687.878.633.132 1.29.084 1.897-.136.274.586.705 1.084 1.246 1.439.54.354 1.17.551 1.816.569.647-.016 1.276-.213 1.817-.567s.972-.854 1.245-1.44c.604.239 1.266.296 1.903.164.636-.132 1.22-.447 1.68-.907.46-.46.776-1.044.908-1.681s.075-1.299-.165-1.903c.586-.274 1.084-.705 1.439-1.246.354-.54.551-1.17.569-1.816zM9.662 14.85l-3.429-3.428 1.293-1.302 2.072 2.072 4.4-4.794 1.347 1.246z"></path></g></svg>');
      }

      .atk-ua {
        @extend .badge;
      }

      .atk-ua-wrap {
        @media only screen and (max-width: 768px) {
          display: block;
        }
      }
    }

    & > .atk-body {
      display: block;
      overflow: hidden;
      position: relative;

      img {
        max-width: 100%;
      }

      & > .atk-content {
        word-break: break-word;

        &.atk-type-collapsed {
          border: 3px solid var(--at-color-bg-grey);
          border-bottom: 0;
          padding: 5px 10px;
          border-radius: $block-radius $block-radius 0 0;
          margin-bottom: -5px;
        }

        & > *:first-child {
          margin-top: 0;
        }

        & > *:last-child {
          margin-bottom: 0;
        }

        .atk-height-limit-btn {
          bottom: 5px;
        }
      }

      & > .atk-pending {
        color: var(--at-color-meta);
        margin: 3px 0;
        font-size: 13px;
        padding: 10px 18px;
        display: block;
        background: var(--at-color-bg-grey);
        border-left: 4px solid #f44336;
      }

      & > .atk-reply-to {
        padding: 5px 15px;
        border-left: 3px solid var(--at-color-border);
        margin-bottom: 10px;
        position: relative;
        margin-top: 10px;

        .atk-meta {
          font-size: 15px;

          .atk-nick {
            color: var(--at-color-main);
          }
        }

        .atk-content {
          margin-top: 5px;
        }
      }

      & > .atk-collapsed {
        margin: 3px 0;
        font-size: 13px;
        padding: 10px 18px;
        display: block;
        background: var(--at-color-bg-grey);
        border-radius: $block-radius;

        .atk-text {
          color: var(--at-color-meta);
        }

        .atk-show-btn {
          color: var(--at-color-main);
          cursor: pointer;
          user-select: none;
          margin-left: 3px;
          &:hover {
            color: var(--at-color-main);
          }
        }
      }
    }

    & > .atk-footer {
      margin-top: 5px;

      .atk-actions {
        display: flex;
        flex-direction: row;
        align-items: center;
        flex-wrap: wrap;

        & > span:not(:last-child):not(.atk-hide) {
          margin-right: 16px;
        }
      }
    }
  }

  /** 内容限高 **/
  .atk-height-limit:after {
    position: absolute;
    z-index: 1;
    display: block;
    overflow: hidden;
    width: 100%;
    content: ' ';
    bottom: 0;
    height: 80px;
    background: var(--at-color-gradient);
  }

  .atk-height-limit-btn {
    z-index: 2;
    position: absolute;
    left: 50%;
    bottom: 10px;
    transform: translateX(-50%);
    cursor: pointer;
    border: 1px solid var(--at-color-border);
    border-radius: $block-radius;
    background: var(--at-color-bg);
    padding: 1px 20px;
    font-size: 15px;
    color: var(--at-color-meta);
    user-select: none;

    &:hover {
      background: var(--at-color-bg-grey);
    }
  }

  // 避免重复显示按钮
  .atk-height-limit .atk-height-limit .atk-height-limit-btn {
    display: none;
  }

  // 限高可滚动
  .atk-height-limit-scroll {
    // @extend .atk-slim-scrollbar;
    margin-top: 10px;
    overflow-y: auto;
    $cBorder: var(--at-color-border);
    $cOverwrite: var(--at-color-bg);
    background:
      /* Shadow covers */
      linear-gradient($cOverwrite 1px, transparent 1px calc(100% - 1px)) center top,
      linear-gradient(transparent calc(100% - 1px), $cOverwrite calc(100% - 1px) 1px) center bottom,
      /* Shadows */ linear-gradient($cBorder 1px, transparent 1px calc(100% - 1px)) center top,
      linear-gradient(transparent calc(100% - 1px), $cBorder calc(100% - 1px) 1px) center bottom;
    background-repeat: no-repeat;
    background-color: transparent;
    background-size:
      100% 1px,
      100% 1px,
      100% 1px,
      100% 1px;
    /* Opera doesn't support this in the shorthand */
    background-attachment: local, local, scroll, scroll;
  }
}

/** 子评论区域 **/
.atk-comment-children {
  & > .atk-comment-wrap {
    margin-top: 10px;
    border-left: 1px dashed transparent;
    border-bottom-color: transparent;
    &:not(:last-child) {
      margin-bottom: 10px;
    }

    & > .atk-comment {
      padding: 0;

      & > .atk-avatar img {
        width: 36px;
        height: 36px;
      }

      & > .atk-main {
        margin-left: 47px;

        & > .atk-body > .atk-content {
        }
      }
    }
  }
}
